{include file="news/header.tpl"}
{literal}
<style type="text/css">
 body {
       
    }
    
    #description { 
        margin-left: 10px;
        position: absolute;
        top: 70px;
        bottom: 0;
        left: 0;
    font-family:Monaco, "Courier New", monospace;
        right: 0;
    }
  
</style>

{/literal}
{include file="news/top.tpl"}
<body>

<!-- 头部// -->


{include file="news/nav.tpl"}
	<!-- start: Content -->
			<div id="content" class="span10">
			
						
			<div class="row-fluid">


<div class="box span12"><!-- Default panel contents -->


<div class="box-content">
  
  <div class="panel-heading" >
  
  
  <span class="icon-file"></span><strong style="font-size:16px;"> {$tempinfo.name}</strong>  <small>{$tempinfo.size}  </small>    <span class="alert alert-success"> {$tempinfo.action} <small>提交于</small>  {$tempinfo.date|date_format:"%m/%d"}  {$tempinfo.remark}</span>  
  
  
  <div class="pull-right">备注:<input type="text" name="remark"  class="control">
<input type="button" value="保存" onclick="return save();" class="btn btn-primary">

</div>
  </div>





<input type="hidden" name="id" id="tempid" class="form-control" value="{$tempinfo.id}"> 


   <textarea name="description" id="c2">{$tempinfo.source}</textarea>
  
<div id="description"></div>





</div>
</div>
 </div>  
{literal}
<script src="/static/ace/src/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/ace/src/theme-crimson_editor.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/ace/src/mode-html.js" type="text/javascript" charset="utf-8"></script>
<script>
window.onload = function() {
	var editor = ace.edit("description");
	var textarea = $('textarea[name="description"]').hide();
	editor.getSession().setValue(textarea.val());
	 editor.setTheme("ace/theme/crimson_editor");
	    
	    var JavaScriptMode = require("ace/mode/html").Mode;
	    editor.getSession().setMode(new JavaScriptMode());
	editor.getSession().on('change', function(){
	  textarea.val(editor.getSession().getValue());
	});
};

function save(){

	var c=$("#c2").val();

	var d=$("#tempid").val();
	var remark=$("input[name='remark']").val();

	if(remark.length<6){
	   alert('备注小于6个字符');
	   return false;
	}

	$.post("/temp/savetemp",{source:c,id:d,remark:remark},function(result){
		if(result.status==true){
	alert(result.message);
			//$("#notice").fadeIn(result.error,5000);
			}else{
				alert(result.message);
				
				//$("#notice").html(result.error);
				}
	},"json")
	}
</script>
{/literal}
{include file="news/footer.tpl"}
